﻿using CNFM_CROCODILE_LOGO.Core.Domain.Entity;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace CNFM_CROCODILE_LOGO.Data.Mappings.DataMappings
{
    /// <summary>
    /// 地区表
    /// </summary>
    /// update-database 
    /// Add-Migration 
    public class AreaMap : IBaseEntityTypeConfiguration
    {
        public AreaMap(ModelBuilder entity)
        {
            entity.Entity<Area>(b =>
            {
                b.Property(e => e.Id)
                    .HasMaxLength(36)
                    .IsUnicode(false)
                    .ValueGeneratedNever();

                b.Property(e => e.Status)
                     .IsUnicode(false)
                     .HasColumnType("int")
                     .HasDefaultValue(0);

                b.Property(e => e.CreateId)
                    .IsRequired()
                    .HasMaxLength(50)
                    .IsUnicode(false);

                b.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                b.Property(e => e.Remarks)
                    .HasMaxLength(200)
                    .IsUnicode(false);

                b.Property(e => e.AreaName)
                    .IsRequired()
                    .HasMaxLength(50)
                    .IsUnicode(false);

                b.Property(e => e.ShortName)
                    .IsRequired()
                    .HasMaxLength(50)
                    .IsUnicode(false);

                b.Property(e => e.MergnName)
                 .HasMaxLength(100)
                 .IsUnicode(false);

                b.Property(e => e.YUnCode)
                    .IsRequired()
                    .HasMaxLength(20)
                    .IsUnicode(false);

                b.Property(e => e.PUnCode)
                    .IsRequired()
                    .HasMaxLength(20)
                    .IsUnicode(false);

                b.Property(e => e.Level)
                     .IsUnicode(false)
                     .HasColumnType("int")
                     .HasDefaultValue(0);
            });
        }
    }
}
